<template>
    <div>
        

    </div>
</template>

<script>
	import {viewPageStationInfo, getCurrentUser } from '../../api/index.js';
    export default {
        data: function(){
            return {
            }   
                
        },
		created(){
			
			sessionStorage.setItem('token', this.$route.query.token);
			this.login()
		},
		methods:{
			getstationData(stcdList) {
			  let data = {
			    currentPage: 1,
			    pageSize: 1000
			  };
			  viewPageStationInfo(data).then((res) => {
			    let data = res.object.dataList.filter((item) => {
			      return item.stcd === stcdList[0].stcd;
			    });
			
			    stationInfo = {
			      stcd: data[0].stcd,
			      stnm: data[0].stnm,
			      calculator: data[0].calculator,
			      reviewer: data[0].reviewer,
			      observer: data[0].observer,
			      calculatorName: data[0].calculatorName,
			      reviewerName: data[0].reviewerName,
			      observerName: data[0].observerName
			    };
			    localStorage.setItem('stationInfo', JSON.stringify(stationInfo));
			
			    this.$router.push('/shishijiangyu');
			  });
			},
			login() {
			  let that = this;
			  getCurrentUser().then((res) => {
			    if (!res.object.stcdList) {
			      that.$message.error('账号未绑定测站信息，请联系管理员');
			      return;
			    }
			
			    sessionStorage.setItem('userInfo', JSON.stringify(res.object));
			    localStorage.setItem('stcdList', JSON.stringify(res.object.stcdList));
			    that.getstationData(res.object.stcdList);
			  });
			},
			
		}
    }
</script>

<style scoped>
.example-p{
    height: 45px;
    display: flex;
    align-items: center;
}
.search-box{
    text-align: center;
    margin-top: 10px;
}
.search{
    width: 300px;
}
ul,li{
    list-style: none;
}
.icon-li{
    display: inline-block;
    padding: 10px;
    width: 120px;
    height: 120px;
}
.icon-li-content{
    display: flex;
    height: 100%;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}
.icon-li-content i{
    font-size: 36px;
    color: #606266;
}
.icon-li-content span{
    margin-top: 10px;
    color: #787878;
}
</style>